﻿/*
name:cookie 名
value:cookie 值
*/
//写入cookie
function setCookie(name, value, Days) {
	var exp = new Date();
	exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);//60*1000=1分钟
	document.cookie = name + "=" + escape(value) + ";path=/;expires=" + exp.toGMTString();
}

///删除cookie
function delCookie(name) {
	var exp = new Date();
	exp.setTime(exp.getTime() - 1);
	var cval = getCookie(name);
	if (cval != null) document.cookie = name + "=" + cval + ";path=/;expires=" + exp.toGMTString();
}

// 获取指定名称的cookie
function getCookie(name) {
	var strcookie = document.cookie;//获取cookie字符串
	var arrcookie = strcookie.split("; ");//分割
	//遍历匹配
	for (var i = 0; i < arrcookie.length; i++) {
		var arr = arrcookie[i].split("=");
		if (arr[0] == name) {
			return arr[1];
		}
	}
	return "";
}



function localStorageGetItem(name)
{
	return localStorage.getItem(name);
}

function localStorageSetItem(name,value) {
	return localStorage.setItem(name, value);
}


function LoadingComplate()
{
	setTimeout(function () {
		$(".loading-wrapper").fadeOut(300);
	}, 1)
}

function ShowLoading() {
	$(".loading-wrapper").show();
}

function HideBox(selector, fadeOut=300)
{
	$(selector).fadeOut(fadeOut);
}

function ShowAsync(selector) {
	$(selector).show();
}

function setTitle(title)
{
	document.title = title;
}

function getInputValue(boxId) {
	var box = document.getElementById(boxId);
	if (box) {
		return box.value
	} else {
		return "";
	}
}


function windowOpen(url, title) {
	if (title) {
		window.open(url, title);
	} else {
		window.open(url);
	}
}

function getHost() {
	return location.host;
}


function getHref() {
	return location.href;
}

function getPath() {
	return location.pathname;
}

function getValue(script) {
	var value = "";
	eval("value=" + script);
	return value;
}


function createmap(options)
{
//	baidusdk.ini("#usermap").options(options);
}
